package net.datafans.exercise.redis;

import redis.clients.jedis.Jedis;

public class ClientTest {
	private static Jedis jedis = new Jedis("192.168.1.105",6379);

	static void string(String key, String val) {
		jedis.set(key, val);
		System.out.println(jedis.get(key));
	}
	static void list(String key, String val) {
		jedis.lpush(key, val);
		System.out.println(jedis.lrange(key, 0, 3));
	}
	static void set(String key, String val) {
		jedis.sadd(key, val);
		System.out.println(jedis.srandmember(key));
	}
	static void map(String key, String field, String val) {
		jedis.hset(key, field, val);
		System.out.println(jedis.hgetAll(key));
	}
	public static void main(String[] args) {
		jedis.connect();
		string("name88", "anyunzhong88");
		// list("namelist", "mysql");
		// set("nameset", "hibernate");
		//map("namemap", "home", "guangzhou");
	}

}
